import request from '@/utils/request'
let baseUrl = process.env.NODE_ENV === 'production' ? 'api/galaxy/std' : '/std'
// 创建优惠券
export const createCoupon = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/coupon/create',
    method: 'post',
    data
  })
// 优惠券列表
export const getCouponList = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/coupon/list',
    method: 'post',
    data
  })
// 有效优惠券

export const getCouponListAvailable = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/coupon/available',
    method: 'post',
    data
  })
// 更改优惠券状态
export const updateStatus = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/coupon/update-status',
    method: 'post',
    data
  })
// 优惠券列表
export const getActivityList = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/activity/list',
    method: 'post',
    data
  })
// 创建活动
export const createActivity = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/activity/create',
    method: 'post',
    data
  })
// 更新活动
export const updateActivity = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/activity/update',
    method: 'post',
    data
  })

export const getActivityDetail = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/activity/info',
    method: 'post',
    data
  })
// 期次列表
export const getTerms = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/activity/terms',
    method: 'post',
    data
  })
export const getProducts = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/common/products',
    method: 'post',
    data
  })
export const getSms = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/common/coupon-sms-templates',
    method: 'post',
    data
  })
export const getWechatSms = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/common/coupon-wechat-templates',
    method: 'post',
    data
  })
export const sendCoupon = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/coupon/send',
    method: 'post',
    data
  })
export const getCouponDetail = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/coupon/info',
    method: 'post',
    data
  })
export const getCouponRecord = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/user-coupon/list',
    method: 'post',
    data
  })
export const getCouponRecordDetail = (data?: any) =>
  request({
    baseURL: baseUrl,
    url: '/user-coupon/info',
    method: 'post',
    data
  })
